import * as ss from 'simple-statistics';
export const sampleCorrelation = (d0, d1, key) => {
  let length = Math.min(d0.length, d1.length)

  let v0 = []
  let v1 = []
  d0.slice(-length).forEach(element => {
    v0.push(element[key]);
  });
  d1.slice(-length).forEach(element => {
    v1.push(element[key]);
  });

  return ss.sampleCorrelation(v0, v1)
}